import { Controller, Get, Post, Body, Param, Delete, Query, Put } from '@nestjs/common';
import { UserAdmin_Service } from './userAdmin.service';
import { UserAdmin_Create_Dto, UserAdmin_Find_Dto, UserAdmin_Update_Dto } from './assets/userAdmin.dto';
import { ApiTags } from '@nestjs/swagger';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { util_Index_ReturnContent } from '@/common/util/index';

@Controller('/adm/userAdmin')
@ApiTags('userAdmin 后台用户')
export class UserAdmin_Controller {
  constructor(private readonly userAdmin_Service: UserAdmin_Service) {}

  @Post('/add')
  @util_ApiResponse_Base({
    dataType: 'dataType_add',
  })
  async userAdmin_Create(@Body() body: UserAdmin_Create_Dto) {
    return util_Index_ReturnContent(await this.userAdmin_Service.userAdmin_Create(body));
  }

  @Get('/list')
  @util_ApiResponse_Base({
    dataType: 'dataType_ell',
  })
  async userAdmin_FindByPage(@Query() query: UserAdmin_Find_Dto) {
    return util_Index_ReturnContent(await this.userAdmin_Service.userAdmin_FindByPage(query));
  }

  @Put('/update')
  @util_ApiResponse_Base({
    dataType: 'dataType_update',
  })
  async userAdmin_Update(@Body() body: UserAdmin_Update_Dto) {
    return util_Index_ReturnContent(await this.userAdmin_Service.userAdmin_Update(body));
  }

  @Delete('/delete/:id')
  @util_ApiResponse_Base({
    dataType: 'dataType_delete',
  })
  async userAdmin_Remove(@Param('id') id: string) {
    return util_Index_ReturnContent(await this.userAdmin_Service.userAdmin_Remove(+id));
  }
}
